package com.puxsoft.example.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.puxsoft.example.dao.CustomerDao;
import com.puxsoft.example.domain.Customer;

@Service
public class CustomerService {

	@Autowired
	private CustomerDao customerDao;

	public void insertCustomer(String customerName,String phone){
		customerDao.insertCustomer(customerName, phone);
	}


    public Customer insertUserWithOld(String customerName,String phone){
    	Customer customer = new Customer();
    	customer.setCustomerName(customerName);
    	customer.setPhone(phone);
    	
    	 customerDao.insertCustomerDomain(customer);  //该方法后，主键已经设置到user中了
    	 
    	 return customer;
    }
    
    
    public Customer findById(String customerId){
    	return customerDao.findById(customerId);
    }
    
    public List<Customer> findAll(){
    	return customerDao.findAll();
    }
    
}
